#ifndef _LB_W_
#define _LB_W_
#define _MODE_FRONT 1
#define _MODE_AFTER 2

struct Node_wgc
{
    struct Node_wgc* next;
    struct Node_wgc* prev;
    char data[0];
};

typedef struct
{
    int size;
    struct Node_wgc tou;
}List;

struct book_ation
{
    int book_id;
    char book_type[40];
    char book_name[40];
    char book_author[40];
};
struct book_ation* b;
extern int book_num;
extern int surplus_book_num;

struct type_ation
{
    int type_id;
    char type_name[40];
    int type_book;
    List* head;
};
struct type_ation* t;
extern int type_num;


struct user
{
    char user_id[10];
    char user_passwd[8];
    char user_name[40];
    long user_ipone;
    char user_sex[20];
    char user_address[40];
    int user_book_num;
    int user_record_num;
    List* head;
    List* head2;
};
struct user* u;
extern int user_num;

struct user_record //用户浏览记录
{
    char record[150];
};

extern char wgc_passwd[8];
extern char wgc_name[20];
extern char wgc[20];



List* establish_head(int size);
void establish_node(List* head, void* data, int mode);
void ergodic(List* head, void (*operation)(void*));
void destory(List* head);
static struct Node_wgc* find(List* head, void* key, int (*cmp)(void* key, void*));
void* find_wgc(List* head, void* key, int (*cmp)(void* key, void*));
int dale_wgc(List* head, void* key, int (*cmp)(void* key, void*));
int modif_wgc(List* head, void* key, void* new_key, int (*cmp)(void* key, void*));
static struct Node_wgc* find2(List* head, void* key1, void* key2, int (*cmp)(void* key1, void* key2, void*));
void* find_wgc2(List* head, void* key1, void* key2, int (*cmp)(void* key1, void* key2, void*));
void ergodic_(List* head, void (*operation)(void*, void*), void* name);

#endif
